import Vue from 'vue'
import App from './App.vue'
import router from './router'

Vue.config.productionTip = false
import './assets/css/whole.css'
import './assets/css/iconfont.css'
import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
Vue.use(ElementUI);
import axios from 'axios'
axios.defaults.baseURL = '/agency/';
Vue.prototype.$http = axios
// 树形表格
import TreeTable from 'vue-table-with-tree-grid'
Vue.use(TreeTable)
Vue.component('tree-table', TreeTable)
// 导入Nprogress包对应的js和css 实现进度条
import NProgress from 'nprogress'
import 'nprogress/nprogress.css'
// 添加请求拦截器
axios.interceptors.request.use(function (config) {
  NProgress.start()
  config.headers.Authorization = sessionStorage.getItem('token')
  return config;
}, function (error) {
  // 对请求错误做些什么
  return Promise.reject(error);
});
// 响应拦截器
axios.interceptors.request.use(function (config) {
  NProgress.done()
  return config
})
// 时间过滤
import moment from 'moment';
Vue.filter('time', function (val) {
  return moment(val * 1000).format('Y-M-D hh:mm:ss');
})
// 富文本编辑器
import VueQuillEditor from 'vue-quill-editor'

// require styles
import 'quill/dist/quill.core.css'
import 'quill/dist/quill.snow.css'
import 'quill/dist/quill.bubble.css'
Vue.use(VueQuillEditor)
new Vue({
  router,
  render: h => h(App)
}).$mount('#app')
